﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TexasHoldem
{
    class MainProgram
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter the played hands, or hit <Enter> to finish.");
            var enteredHands = ReadHandsFromConsole();
            
            var evaluatedHands = new TexasHoldemEvaluator().EvaluateHands(enteredHands);

            Console.WriteLine("The hands rank as follows:");
            WriteHandsToConsole(evaluatedHands);
            Console.ReadKey();
        }

        static IEnumerable<string> ReadHandsFromConsole()
        {
            var handsToEvaluate = new List<string>();
            string readHand = "";
            while (!string.IsNullOrWhiteSpace(readHand = Console.ReadLine())) {
                handsToEvaluate.Add(readHand.Trim());
            }
            return handsToEvaluate;
        }

        static void WriteHandsToConsole(IEnumerable<string> evaluatedHands)
        {
            foreach (var evaluatedHand in evaluatedHands)
                Console.WriteLine(evaluatedHand);
        }
    }
}
